<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
       var address=prompt("请输入邮箱",undefined)
       var point=address.indexOf(".")
       var alt=address.indexOf("@")
        if(address.length<1){
            alert("邮箱不能为空");
        }else if(point!=-1&&alt!=-1&&alt<point){
            alert(address)
       }else{
            alert("格式错误")
        }
    </script>
</body>
</html>